/*
 * Copyright 2007-2009 Perttu "celeron55" Ahola <celeron55@gmail.com>
 *
 * This file is part of jukumagic.
 *
 * jukumagic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * jukumagic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with jukumagic.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef RATSNEST_H_
#define RATSNEST_H_

#include "common.h"
#include "boardpoint.h"
#include <wx/wx.h>
#include <list>

class RatLine
{
public:
	int m_x1, m_y1, m_x2, m_y2;
	bool operator==(const RatLine &l){
		return ((m_x1==l.m_x1 && m_y1==l.m_y1 && m_x2==l.m_x2 && m_y2==l.m_y2)
				|| (m_x1==l.m_x2 && m_y1==l.m_y2 && m_x2==l.m_x1 && m_y2==l.m_y1));
	}
};

class Board;
class Netlist;

class RatsNest
{
	std::list<RatLine> m_lines;
	bool m_is_inverse;
public:
	RatsNest();
	~RatsNest();
	void Draw(wxDC &dc, wxWindow *window, wxPoint origin);

	void Create(Board *board, Netlist *netlist, bool only_selected);
	//creates a rats nest of points that shouldn't be connected
	void CreateInv(Board *board, Netlist *netlist, bool only_selected);
	void Clear();
};

#endif
